package com.itlong.cloud.smartcard.resource;

import com.itlong.cloud.POJO.VO.smartcard.SmartCardOldPushVO;
import com.itlong.cloud.project.smartcard.ISmartCardOldPushServiceClient;
import com.itlong.cloud.smartcard.service.ISmartCardOldPushService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      旧一卡通_推送模块。
 * <desc/>
 *
 * @createDate 2017-12-13.
 */
@RestController
public class SmartCardOldPushServiceResource implements ISmartCardOldPushServiceClient{


    @Autowired
    ISmartCardOldPushService iSmartCardOldPushService;
    /**
     * <desc>
     *      获取推送消息列表。
     * <desc/>
     *
     * @param  projectId 项目编号
     * @param  pageNo 当前页数
     * @param  pageSize 每页显示数据
     * @return
     * @author shengen.T
     * @createDate 2017-12-13
     */
    @Override
    @RequestMapping(path = "/push/pushInfo/manage/list",method = RequestMethod.POST)
    public Page<SmartCardOldPushVO> getPushInfoPage(@RequestParam("projectId") String projectId,
                                             @RequestParam("pageNo") String pageNo,
                                             @RequestParam("pageSize") String pageSize) throws Exception{
        return iSmartCardOldPushService.getPushInfoList(projectId,pageNo,pageSize);
    }

    /**
     * <desc>
     *      旧一卡通添加推送。
     * <desc/>
     *
     * @param projectId 项目编号
     * @param infoContent 消息内容
     * @param startTime 开始推送时间
     * @param endTime  结束推送时间
     * @return
     * @author shengen.T
     * @createDate 2017-12-18
     */
    @Override
    @RequestMapping(path = "/push/pushInfo/manage/add",method = RequestMethod.POST)
    public boolean addpushInfo(@RequestParam("projectId") String projectId,
                               @RequestParam("infoContent") String infoContent,
                               @RequestParam("startTime") String startTime,
                               @RequestParam("endTime") String endTime) throws Exception{
        return iSmartCardOldPushService.addpushInfo(projectId,infoContent,startTime,endTime);
    }
}
